package cn.itsource.user.controller;

import cn.itsource.basic.util.AxajResult;
import cn.itsource.user.domain.dto.UserDto;
import cn.itsource.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;
    /**
     * 前台用户注册
     * @return userDto 前台注册信息
     */
    @PostMapping("/register")
    public AxajResult register(@RequestBody UserDto userDto){
        try {
            userService.register(userDto);
            return new AxajResult();
        } catch (Exception e) {
            e.printStackTrace();
            return new AxajResult(false,e.getMessage());
        }
    }
}
